@extends('layouts.adminBrand')
@section('content')




	<!--结果集标题与导航组件 开始-->
	<div class="result_wrap">
		<div class="result_title">
			<h3>编辑品牌&车系</h3>
			@if(count($errors)>0)
				<div class="mark">
					@if(is_object($errors))
						@foreach($errors->all() as $error)
							<p>{{$error}}</p>
						@endforeach
					@else
						<p>{{$errors}}</p>
					@endif
				</div>
			@endif
		</div>

	</div>
	<!--结果集标题与导航组件 结束-->

	<div class="result_wrap">
        <form action="{{url('admin/brand/'.$odata->bid)}}" method="post">
            {{--put方法提交--}}
            <input type="hidden" name="_method" value="put">
            {{--CSRF保护--}}
            {{csrf_field()}}
			<table class="add_tab">
				<tbody>
				<tr>
					<th width="120">所属品牌：</th>
					<td>
						<select name="pid">
							<option value="0">品牌</option>
							@foreach($data as $d)
								<option @if( $odata->pid ==$d->bid) selected="selected" @endif value="{{$d->bid}}">{{$d->bname}}</option>
							@endforeach
						</select>
					</td>
				</tr>

				<tr>
					<th>品牌名称：</th>
					<td>
						<input type="text" class="sm" name="bname" value="{{$odata->bname}}">
					</td>
				</tr>
				<tr>
					<th>缩略图：</th>
					<td>
						<input type="text" size="50" name="logo" value="{{$odata->logo}}">


						{{--uploadify--}}
						<input id="file_upload" name="file_upload" type="file" multiple="true">

						<script src="{{asset('public/org/uploadify/jquery.uploadify.min.js')}}" type="text/javascript"></script>
						<link rel="stylesheet" type="text/css" href="{{asset('public/org/uploadify/uploadify.css')}}">
						<script type="text/javascript">
							<?php $timestamp = time();?>
                            $(function() {
								$('#file_upload').uploadify({
									'buttonText' : '图片上传',
									'formData'     : {
										'timestamp' : '<?php echo $timestamp;?>',
										//修改token为laravel形式
										'_token'     : '{{csrf_token()}}',
									},
									'swf'      : '{{asset('public/org/uploadify/uploadify.swf')}}',
									//下面的方法上传有安全问题，没有验证，所以自己写一个方法（在CommonCtroller里）
									'uploader' : '{{asset('admin/upload')}}',
									'onUploadSuccess' : function(file, data, response) {
//										alert(data);
										$('input[name=logo]').val(data);
										$('#logo_img').attr('src','/'+data);
									}
								});
							});
						</script>
						{{--uploadify样式微调--}}
						<style>
							.uploadify{display:inline-block;}
							.uploadify-button{border:none; border-radius:5px; margin-top:8px;}
							table.add_tab tr td span.uploadify-button-text{color: #FFF; margin:0;}
						</style>





					</td>
				</tr>
				<tr>
					<th></th>
					<td>
						<img src="/{{$odata->logo}}" alt="" id="logo_img" style="max-width: 75px; max-height:75px;">
					</td>
				</tr>


				<tr>
					<th></th>
					<td>
						<input type="submit" value="提交">
						{{--<input type="button" class="back" onclick="history.go(-1)" value="返回">--}}
					</td>
				</tr>
				</tbody>
			</table>
		</form>
	</div>




@endsection